# encoding: utf-8

from zheezes.po.ip_addr import IpAddr 

from google.appengine.ext import webapp
from google.appengine.ext.webapp.util import run_wsgi_app
from google.appengine.ext import db
from google.appengine.api import taskqueue

class MainPage(webapp.RequestHandler):
    def get(self):  
        type = self.request.get("type")
        if cmp(type, "task"):
            ipaddrs = db.GqlQuery("SELECT * FROM IpAddr LIMIT 1000");       
            for ipa in ipaddrs:
                ipa.delete()
        else:
            self.response.headers['Content-Type'] = 'text/plain'
            self.response.out.write('Succ!')
        
application = webapp.WSGIApplication([('/.*', MainPage)], debug=True)

def main():
    run_wsgi_app(application)

if __name__ == "__main__":
    main()
